/*
 * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

if (!("finalizeConstruction" in ViewPU.prototype)) {
    Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
}
const LengthMetrics = requireNapi('arkui.node').LengthMetrics;
export var IconType;
(function (j13) {
    j13[j13["BADGE"] = 1] = "BADGE";
    j13[j13["NORMAL_ICON"] = 2] = "NORMAL_ICON";
    j13[j13["SYSTEM_ICON"] = 3] = "SYSTEM_ICON";
    j13[j13["HEAD_SCULPTURE"] = 4] = "HEAD_SCULPTURE";
    j13[j13["APP_ICON"] = 5] = "APP_ICON";
    j13[j13["PREVIEW"] = 6] = "PREVIEW";
    j13[j13["LONGITUDINAL"] = 7] = "LONGITUDINAL";
    j13[j13["VERTICAL"] = 8] = "VERTICAL";
})(IconType || (IconType = {}));
var FontSizeScaleLevel;
(function (i13) {
    i13[i13["LEVEL1"] = 1.75] = "LEVEL1";
    i13[i13["LEVEL2"] = 2] = "LEVEL2";
    i13[i13["LEVEL3"] = 3.2] = "LEVEL3";
})(FontSizeScaleLevel || (FontSizeScaleLevel = {}));
var ItemHeight;
(function (h13) {
    h13[h13["FIRST_HEIGHT"] = 48] = "FIRST_HEIGHT";
    h13[h13["SECOND_HEIGHT"] = 56] = "SECOND_HEIGHT";
    h13[h13["THIRD_HEIGHT"] = 64] = "THIRD_HEIGHT";
    h13[h13["FOURTH_HEIGHT"] = 72] = "FOURTH_HEIGHT";
    h13[h13["FIFTH_HEIGHT"] = 96] = "FIFTH_HEIGHT";
})(ItemHeight || (ItemHeight = {}));
const TEXT_MAX_LINE = 1;
const ITEM_BORDER_SHOWN = 2;
const TEXT_COLUMN_SPACE = 4;
const TEXT_SAFE_MARGIN = 8;
const LISTITEM_PADDING = 6;
const SWITCH_PADDING = 4;
const STACK_PADDING = 4;
const BADGE_SIZE = 8;
const SMALL_ICON_SIZE = 16;
const SYSTEM_ICON_SIZE = 24;
const TEXT_ARROW_HEIGHT = 32;
const SAFE_LIST_PADDING = 32;
const HEADSCULPTURE_SIZE = 40;
const BUTTON_SIZE = 28;
const APP_ICON_SIZE = 64;
const PREVIEW_SIZE = 96;
const LONGITUDINAL_SIZE = 96;
const VERTICAL_SIZE = 96;
const NORMAL_ITEM_ROW_SPACE = 16;
const SPECIAL_ITEM_ROW_SPACE = 0;
const SPECIAL_ICON_SIZE = 0;
const DEFAULT_ROW_SPACE = 0;
const SPECICAL_ROW_SPACE = 4;
const OPERATEITEM_ICONLIKE_SIZE = 24;
const OPERATEITEM_ARROW_WIDTH = 12;
const OPERATEITEM_ICON_CLICKABLE_SIZE = 40;
const OPERATEITEM_IMAGE_SIZE = 48;
const DEFAULT_ITEM_SPACE_WIDTH = 12;
const DEFAULT_STACK_PADDING = 12;
const DEFAULT_FLEX_OUTLINE_WIDTH = 4;
const DEFAULT_COMPOSE_ITEM_PADDING = 8;
const RIGHT_CONTENT_NULL_LEFTWIDTH = '100%';
const RIGHT_CONTENT_NULL_RIGHTWIDTH = '0vp';
const LEFT_PART_WIDTH = 'calc(66% - 12vp)';
const RIGHT_PART_WIDTH = '34%';
const RIGHT_ONLY_ARROW_WIDTH = '24vp';
const LEFT_ONLY_ARROW_WIDTH = 'calc(100% - ${RIGHT_ONLY_ARROW_WIDTH})';
const RIGHT_ONLY_IMAGE_WIDTH = '48vp';
const LEFT_ONLY_IMAGE_WIDTH = 'calc(100% - ${RIGHT_ONLY_IMAGE_WIDTH})';
const RIGHT_ONLY_ICON_WIDTH = '32vp';
const LEFT_ONLY_ICON_WIDTH = 'calc(100% - ${RIGHT_ONLY_ICON_WIDTH})';
const RIGHT_ICON_SUB_ICON_WIDTH = '72vp';
const LEFT_ICON_SUB_ICON_WIDTH = 'calc(100% - ${RIGHT_ICON_SUB_ICON_WIDTH})';
const RIGHT_ONLY_RADIO_WIDTH = '24vp';
const LEFT_ONLY_RADIO_WIDTH = 'calc(100% - ${RIGHT_ONLY_RADIO_WIDTH})';
const RIGHT_ONLY_CHECKBOX_WIDTH = '24vp';
const LEFT_ONLY_CHECKBOX_WIDTH = 'calc(100% - ${RIGHT_ONLY_CHECKBOX_WIDTH})';
const RIGHT_ONLY_SWITCH_WIDTH = '40vp';
const LEFT_ONLY_SWITCH_WIDTH = 'calc(100% - ${RIGHT_ONLY_SWITCH_WIDTH})';
const ICON_SIZE_MAP = new Map([
    [IconType.BADGE, BADGE_SIZE],
    [IconType.NORMAL_ICON, SMALL_ICON_SIZE],
    [IconType.SYSTEM_ICON, SYSTEM_ICON_SIZE],
    [IconType.HEAD_SCULPTURE, HEADSCULPTURE_SIZE],
    [IconType.APP_ICON, APP_ICON_SIZE],
    [IconType.PREVIEW, PREVIEW_SIZE],
    [IconType.LONGITUDINAL, LONGITUDINAL_SIZE],
    [IconType.VERTICAL, VERTICAL_SIZE]
]);
class ContentItemStruct extends ViewPU {
    constructor(b13, c13, d13, e13 = -1, f13 = undefined, g13) {
        super(b13, d13, e13, g13);
        if (typeof f13 === "function") {
            this.paramsGenerator_ = f13;
        }
        this.__iconStyle = new SynchedPropertySimpleOneWayPU(c13.iconStyle, this, "iconStyle");
        this.__icon = new SynchedPropertyObjectOneWayPU(c13.icon, this, "icon");
        this.__primaryText = new SynchedPropertyObjectOneWayPU(c13.primaryText, this, "primaryText");
        this.__secondaryText = new SynchedPropertyObjectOneWayPU(c13.secondaryText, this, "secondaryText");
        this.__description = new SynchedPropertyObjectOneWayPU(c13.description, this, "description");
        this.__itemRowSpace = new ObservedPropertySimplePU(NORMAL_ITEM_ROW_SPACE, this, "itemRowSpace");
        this.__leftWidth = new SynchedPropertySimpleOneWayPU(c13.leftWidth, this, "leftWidth");
        this.__primaryTextColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.font_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "primaryTextColor");
        this.__secondaryTextColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.font_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "secondaryTextColor");
        this.__descriptionColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.font_tertiary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "descriptionColor");
        this.__fontSizeScale = new SynchedPropertySimpleOneWayPU(c13.fontSizeScale, this, "fontSizeScale");
        this.__parentDirection = new SynchedPropertySimpleOneWayPU(c13.parentDirection, this, "parentDirection");
        this.__itemDirection = new SynchedPropertySimpleOneWayPU(c13.itemDirection, this, "itemDirection");
        this.__iconImageModifier = new SynchedPropertyObjectOneWayPU(c13.iconImageModifier, this, "iconImageModifier");
        this.__primaryTextModifier = new SynchedPropertyObjectOneWayPU(c13.primaryTextModifier, this, "primaryTextModifier");
        this.__secondaryTextModifier = new SynchedPropertyObjectOneWayPU(c13.secondaryTextModifier, this, "secondaryTextModifier");
        this.__descriptionModifier = new SynchedPropertyObjectOneWayPU(c13.descriptionModifier, this, "descriptionModifier");
        this.__contentItemPadding = new SynchedPropertyObjectOneWayPU(c13.contentItemPadding, this, "contentItemPadding");
        this.__itemSpace = new SynchedPropertySimpleOneWayPU(c13.itemSpace, this, "itemSpace");
        this.setInitiallyProvidedValue(c13);
        this.declareWatch("iconStyle", this.onPropChange);
        this.declareWatch("icon", this.onPropChange);
        this.declareWatch("primaryText", this.onPropChange);
        this.declareWatch("secondaryText", this.onPropChange);
        this.declareWatch("description", this.onPropChange);
        this.finalizeConstruction();
    }
    setInitiallyProvidedValue(a13) {
        if (a13.iconStyle === undefined) {
            this.__iconStyle.set(null);
        }
        if (a13.icon === undefined) {
            this.__icon.set(null);
        }
        if (a13.primaryText === undefined) {
            this.__primaryText.set(null);
        }
        if (a13.secondaryText === undefined) {
            this.__secondaryText.set(null);
        }
        if (a13.description === undefined) {
            this.__description.set(null);
        }
        if (a13.itemRowSpace !== undefined) {
            this.itemRowSpace = a13.itemRowSpace;
        }
        if (a13.leftWidth === undefined) {
            this.__leftWidth.set(LEFT_PART_WIDTH);
        }
        if (a13.primaryTextColor !== undefined) {
            this.primaryTextColor = a13.primaryTextColor;
        }
        if (a13.secondaryTextColor !== undefined) {
            this.secondaryTextColor = a13.secondaryTextColor;
        }
        if (a13.descriptionColor !== undefined) {
            this.descriptionColor = a13.descriptionColor;
        }
        if (a13.iconImageModifier === undefined) {
            this.__iconImageModifier.set(null);
        }
        if (a13.primaryTextModifier === undefined) {
            this.__primaryTextModifier.set(null);
        }
        if (a13.secondaryTextModifier === undefined) {
            this.__secondaryTextModifier.set(null);
        }
        if (a13.descriptionModifier === undefined) {
            this.__descriptionModifier.set(null);
        }
        if (a13.contentItemPadding === undefined) {
            this.__contentItemPadding.set(null);
        }
        if (a13.itemSpace === undefined) {
            this.__itemSpace.set(DEFAULT_ITEM_SPACE_WIDTH);
        }
    }
    updateStateVars(z12) {
        this.__iconStyle.reset(z12.iconStyle);
        this.__icon.reset(z12.icon);
        this.__primaryText.reset(z12.primaryText);
        this.__secondaryText.reset(z12.secondaryText);
        this.__description.reset(z12.description);
        this.__leftWidth.reset(z12.leftWidth);
        this.__fontSizeScale.reset(z12.fontSizeScale);
        this.__parentDirection.reset(z12.parentDirection);
        this.__itemDirection.reset(z12.itemDirection);
        this.__iconImageModifier.reset(z12.iconImageModifier);
        this.__primaryTextModifier.reset(z12.primaryTextModifier);
        this.__secondaryTextModifier.reset(z12.secondaryTextModifier);
        this.__descriptionModifier.reset(z12.descriptionModifier);
        this.__contentItemPadding.reset(z12.contentItemPadding);
        this.__itemSpace.reset(z12.itemSpace);
    }
    purgeVariableDependenciesOnElmtId(y12) {
        this.__iconStyle.purgeDependencyOnElmtId(y12);
        this.__icon.purgeDependencyOnElmtId(y12);
        this.__primaryText.purgeDependencyOnElmtId(y12);
        this.__secondaryText.purgeDependencyOnElmtId(y12);
        this.__description.purgeDependencyOnElmtId(y12);
        this.__itemRowSpace.purgeDependencyOnElmtId(y12);
        this.__leftWidth.purgeDependencyOnElmtId(y12);
        this.__primaryTextColor.purgeDependencyOnElmtId(y12);
        this.__secondaryTextColor.purgeDependencyOnElmtId(y12);
        this.__descriptionColor.purgeDependencyOnElmtId(y12);
        this.__fontSizeScale.purgeDependencyOnElmtId(y12);
        this.__parentDirection.purgeDependencyOnElmtId(y12);
        this.__itemDirection.purgeDependencyOnElmtId(y12);
        this.__iconImageModifier.purgeDependencyOnElmtId(y12);
        this.__primaryTextModifier.purgeDependencyOnElmtId(y12);
        this.__secondaryTextModifier.purgeDependencyOnElmtId(y12);
        this.__descriptionModifier.purgeDependencyOnElmtId(y12);
        this.__contentItemPadding.purgeDependencyOnElmtId(y12);
        this.__itemSpace.purgeDependencyOnElmtId(y12);
    }
    aboutToBeDeleted() {
        this.__iconStyle.aboutToBeDeleted();
        this.__icon.aboutToBeDeleted();
        this.__primaryText.aboutToBeDeleted();
        this.__secondaryText.aboutToBeDeleted();
        this.__description.aboutToBeDeleted();
        this.__itemRowSpace.aboutToBeDeleted();
        this.__leftWidth.aboutToBeDeleted();
        this.__primaryTextColor.aboutToBeDeleted();
        this.__secondaryTextColor.aboutToBeDeleted();
        this.__descriptionColor.aboutToBeDeleted();
        this.__fontSizeScale.aboutToBeDeleted();
        this.__parentDirection.aboutToBeDeleted();
        this.__itemDirection.aboutToBeDeleted();
        this.__iconImageModifier.aboutToBeDeleted();
        this.__primaryTextModifier.aboutToBeDeleted();
        this.__secondaryTextModifier.aboutToBeDeleted();
        this.__descriptionModifier.aboutToBeDeleted();
        this.__contentItemPadding.aboutToBeDeleted();
        this.__itemSpace.aboutToBeDeleted();
        SubscriberManager.Get().delete(this.id__());
        this.aboutToBeDeletedInternal();
    }
    get iconStyle() {
        return this.__iconStyle.get();
    }
    set iconStyle(x12) {
        this.__iconStyle.set(x12);
    }
    get icon() {
        return this.__icon.get();
    }
    set icon(w12) {
        this.__icon.set(w12);
    }
    get primaryText() {
        return this.__primaryText.get();
    }
    set primaryText(v12) {
        this.__primaryText.set(v12);
    }
    get secondaryText() {
        return this.__secondaryText.get();
    }
    set secondaryText(u12) {
        this.__secondaryText.set(u12);
    }
    get description() {
        return this.__description.get();
    }
    set description(t12) {
        this.__description.set(t12);
    }
    get itemRowSpace() {
        return this.__itemRowSpace.get();
    }
    set itemRowSpace(s12) {
        this.__itemRowSpace.set(s12);
    }
    get leftWidth() {
        return this.__leftWidth.get();
    }
    set leftWidth(r12) {
        this.__leftWidth.set(r12);
    }
    get primaryTextColor() {
        return this.__primaryTextColor.get();
    }
    set primaryTextColor(q12) {
        this.__primaryTextColor.set(q12);
    }
    get secondaryTextColor() {
        return this.__secondaryTextColor.get();
    }
    set secondaryTextColor(p12) {
        this.__secondaryTextColor.set(p12);
    }
    get descriptionColor() {
        return this.__descriptionColor.get();
    }
    set descriptionColor(o12) {
        this.__descriptionColor.set(o12);
    }
    get fontSizeScale() {
        return this.__fontSizeScale.get();
    }
    set fontSizeScale(n12) {
        this.__fontSizeScale.set(n12);
    }
    get parentDirection() {
        return this.__parentDirection.get();
    }
    set parentDirection(m12) {
        this.__parentDirection.set(m12);
    }
    get itemDirection() {
        return this.__itemDirection.get();
    }
    set itemDirection(l12) {
        this.__itemDirection.set(l12);
    }
    get iconImageModifier() {
        return this.__iconImageModifier.get();
    }
    set iconImageModifier(k12) {
        this.__iconImageModifier.set(k12);
    }
    get primaryTextModifier() {
        return this.__primaryTextModifier.get();
    }
    set primaryTextModifier(j12) {
        this.__primaryTextModifier.set(j12);
    }
    get secondaryTextModifier() {
        return this.__secondaryTextModifier.get();
    }
    set secondaryTextModifier(i12) {
        this.__secondaryTextModifier.set(i12);
    }
    get descriptionModifier() {
        return this.__descriptionModifier.get();
    }
    set descriptionModifier(h12) {
        this.__descriptionModifier.set(h12);
    }
    get contentItemPadding() {
        return this.__contentItemPadding.get();
    }
    set contentItemPadding(g12) {
        this.__contentItemPadding.set(g12);
    }
    get itemSpace() {
        return this.__itemSpace.get();
    }
    set itemSpace(f12) {
        this.__itemSpace.set(f12);
    }
    onWillApplyTheme(e12) {
        this.primaryTextColor = e12.colors.fontPrimary;
        this.secondaryTextColor = e12.colors.fontSecondary;
        this.descriptionColor = e12.colors.fontTertiary;
    }
    onPropChange() {
        if (this.icon == null && this.iconStyle == null) {
            this.itemRowSpace = SPECIAL_ITEM_ROW_SPACE;
        }
        else {
            this.itemRowSpace = NORMAL_ITEM_ROW_SPACE;
        }
    }
    aboutToAppear() {
        this.onPropChange();
    }
    createIcon(n11 = null) {
        this.observeComponentCreation2((p11, q11) => {
            If.create();
            if (this.icon != null && this.iconStyle != null && ICON_SIZE_MAP.has(this.iconStyle)) {
                this.ifElseBranchUpdateFunction(0, () => {
                    this.observeComponentCreation2((u11, v11) => {
                        If.create();
                        if (this.iconStyle <= IconType.PREVIEW) {
                            this.ifElseBranchUpdateFunction(0, () => {
                                this.observeComponentCreation2((c12, d12) => {
                                    Image.create(this.icon);
                                    Image.objectFit(ImageFit.Contain);
                                    Image.width(ICON_SIZE_MAP.get(this.iconStyle));
                                    Image.height(ICON_SIZE_MAP.get(this.iconStyle));
                                    Image.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_default_m'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                                    Image.focusable(false);
                                    Image.draggable(false);
                                    Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.icon_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                                    Image.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.iconImageModifier));
                                    Image.flexShrink(0);
                                }, Image);
                            });
                        }
                        else {
                            this.ifElseBranchUpdateFunction(1, () => {
                                this.observeComponentCreation2((y11, z11) => {
                                    Image.create(this.icon);
                                    Image.objectFit(ImageFit.Contain);
                                    Image.constraintSize({
                                        minWidth: SPECIAL_ICON_SIZE,
                                        maxWidth: ICON_SIZE_MAP.get(this.iconStyle),
                                        minHeight: SPECIAL_ICON_SIZE,
                                        maxHeight: ICON_SIZE_MAP.get(this.iconStyle)
                                    });
                                    Image.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_default_m'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                                    Image.focusable(false);
                                    Image.draggable(false);
                                    Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.icon_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                                    Image.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.iconImageModifier));
                                    Image.flexShrink(0);
                                }, Image);
                            });
                        }
                    }, If);
                    If.pop();
                });
            }
            else {
                this.ifElseBranchUpdateFunction(1, () => {
                });
            }
        }, If);
        If.pop();
    }
    createText(q10 = null) {
        this.observeComponentCreation2((l11, m11) => {
            Column.create({ space: TEXT_COLUMN_SPACE });
            Column.flexShrink(1);
            Column.margin(this.fontSizeScale >= FontSizeScaleLevel.LEVEL1 ? undefined : {
                top: TEXT_SAFE_MARGIN,
                bottom: TEXT_SAFE_MARGIN
            });
            Column.alignItems(HorizontalAlign.Start);
        }, Column);
        this.observeComponentCreation2((j11, k11) => {
            Text.create(this.primaryText);
            Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.Body_L'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
            Text.fontColor(ObservedObject.GetRawObject(this.primaryTextColor));
            Text.fontWeight(FontWeight.Medium);
            Text.focusable(true);
            Text.draggable(false);
            Text.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.primaryTextModifier));
        }, Text);
        Text.pop();
        this.observeComponentCreation2((c11, d11) => {
            If.create();
            if (this.secondaryText != null) {
                this.ifElseBranchUpdateFunction(0, () => {
                    this.observeComponentCreation2((h11, i11) => {
                        Text.create(this.secondaryText);
                        Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.Body_M'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                        Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor));
                        Text.draggable(false);
                        Text.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.secondaryTextModifier));
                    }, Text);
                    Text.pop();
                });
            }
            else {
                this.ifElseBranchUpdateFunction(1, () => {
                });
            }
        }, If);
        If.pop();
        this.observeComponentCreation2((v10, w10) => {
            If.create();
            if (this.description != null) {
                this.ifElseBranchUpdateFunction(0, () => {
                    this.observeComponentCreation2((a11, b11) => {
                        Text.create(this.description);
                        Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.Body_M'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                        Text.fontColor(ObservedObject.GetRawObject(this.descriptionColor));
                        Text.draggable(false);
                        Text.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.descriptionModifier));
                    }, Text);
                    Text.pop();
                });
            }
            else {
                this.ifElseBranchUpdateFunction(1, () => {
                });
            }
        }, If);
        If.pop();
        Column.pop();
    }
    isColumnDirection() {
        return this.itemDirection === FlexDirection.Column;
    }
    isParentColumnDirection() {
        return this.parentDirection === FlexDirection.Column;
    }
    getItemSpace() {
        if (this.isColumnDirection()) {
            return LengthMetrics.resource({ "id": -1, "type": 10002, params: ['sys.float.padding_level1'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
        }
        return LengthMetrics.vp(this.itemSpace ?? DEFAULT_ITEM_SPACE_WIDTH);
    }
    initialRender() {
        this.observeComponentCreation2((o10, p10) => {
            Flex.create({
                space: { main: this.getItemSpace() },
                direction: this.itemDirection,
                justifyContent: FlexAlign.Start,
                alignItems: this.isColumnDirection() ? ItemAlign.Start : ItemAlign.Center,
            });
            Flex.margin({
                end: this.isParentColumnDirection() ?
                LengthMetrics.vp(0) :
                LengthMetrics.vp(this.itemSpace ?? DEFAULT_ITEM_SPACE_WIDTH)
            });
            Flex.width(this.isParentColumnDirection() ? undefined : this.leftWidth);
            Flex.flexShrink(this.isParentColumnDirection() ? 0 : 1);
        }, Flex);
        this.createIcon.bind(this)();
        this.createText.bind(this)();
        Flex.pop();
    }
    rerender() {
        this.updateDirtyElements();
    }
}
class CreateIconParam {
}
class OperateItemStruct extends ViewPU {
    constructor(h10, i10, j10, k10 = -1, l10 = undefined, m10) {
        super(h10, j10, k10, m10);
        if (typeof l10 === "function") {
            this.paramsGenerator_ = l10;
        }
        this.__arrow = new SynchedPropertyObjectOneWayPU(i10.arrow, this, "arrow");
        this.__icon = new SynchedPropertyObjectOneWayPU(i10.icon, this, "icon");
        this.__subIcon = new SynchedPropertyObjectOneWayPU(i10.subIcon, this, "subIcon");
        this.__button = new SynchedPropertyObjectOneWayPU(i10.button, this, "button");
        this.__switch = new SynchedPropertyObjectOneWayPU(i10.switch, this, "switch");
        this.__checkBox = new SynchedPropertyObjectOneWayPU(i10.checkBox, this, "checkBox");
        this.__radio = new SynchedPropertyObjectOneWayPU(i10.radio, this, "radio");
        this.__image = new SynchedPropertyObjectOneWayPU(i10.image, this, "image");
        this.__text = new SynchedPropertyObjectOneWayPU(i10.text, this, "text");
        this.__switchState = new ObservedPropertySimplePU(false, this, "switchState");
        this.__radioState = new ObservedPropertySimplePU(false, this, "radioState");
        this.__checkBoxState = new ObservedPropertySimplePU(false, this, "checkBoxState");
        this.__rightWidth = new SynchedPropertySimpleOneWayPU(i10.rightWidth, this, "rightWidth");
        this.__secondaryTextColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.font_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "secondaryTextColor");
        this.__hoveringColor = new ObservedPropertyObjectPU('#0d000000', this, "hoveringColor");
        this.__activedColor = new ObservedPropertyObjectPU('#1a0a59f7', this, "activedColor");
        this.__parentCanFocus = new SynchedPropertySimpleTwoWayPU(i10.parentCanFocus, this, "parentCanFocus");
        this.__parentCanTouch = new SynchedPropertySimpleTwoWayPU(i10.parentCanTouch, this, "parentCanTouch");
        this.__parentIsHover = new SynchedPropertySimpleTwoWayPU(i10.parentIsHover, this, "parentIsHover");
        this.__parentCanHover = new SynchedPropertySimpleTwoWayPU(i10.parentCanHover, this, "parentCanHover");
        this.__parentIsActive = new SynchedPropertySimpleTwoWayPU(i10.parentIsActive, this, "parentIsActive");
        this.__parentFrontColor = new SynchedPropertyObjectTwoWayPU(i10.parentFrontColor, this, "parentFrontColor");
        this.__parentDirection = new SynchedPropertySimpleTwoWayPU(i10.parentDirection, this, "parentDirection");
        this.__isParentCanTouch = new SynchedPropertySimpleTwoWayPU(i10.isParentCanTouch, this, "isParentCanTouch");
        this.__rowSpace = new ObservedPropertySimplePU(DEFAULT_ROW_SPACE, this, "rowSpace");
        this.__iconTextFlag = new ObservedPropertySimplePU(false, this, "iconTextFlag");
        this.setInitiallyProvidedValue(i10);
        this.declareWatch("arrow", this.onPropChange);
        this.declareWatch("icon", this.onPropChange);
        this.declareWatch("subIcon", this.onPropChange);
        this.declareWatch("button", this.onPropChange);
        this.declareWatch("switch", this.onPropChange);
        this.declareWatch("checkBox", this.onPropChange);
        this.declareWatch("radio", this.onPropChange);
        this.declareWatch("image", this.onPropChange);
        this.declareWatch("text", this.onPropChange);
        this.finalizeConstruction();
    }
    setInitiallyProvidedValue(g10) {
        if (g10.arrow === undefined) {
            this.__arrow.set(null);
        }
        if (g10.icon === undefined) {
            this.__icon.set(null);
        }
        if (g10.subIcon === undefined) {
            this.__subIcon.set(null);
        }
        if (g10.button === undefined) {
            this.__button.set(null);
        }
        if (g10.switch === undefined) {
            this.__switch.set(null);
        }
        if (g10.checkBox === undefined) {
            this.__checkBox.set(null);
        }
        if (g10.radio === undefined) {
            this.__radio.set(null);
        }
        if (g10.image === undefined) {
            this.__image.set(null);
        }
        if (g10.text === undefined) {
            this.__text.set(null);
        }
        if (g10.switchState !== undefined) {
            this.switchState = g10.switchState;
        }
        if (g10.radioState !== undefined) {
            this.radioState = g10.radioState;
        }
        if (g10.checkBoxState !== undefined) {
            this.checkBoxState = g10.checkBoxState;
        }
        if (g10.rightWidth === undefined) {
            this.__rightWidth.set(RIGHT_PART_WIDTH);
        }
        if (g10.secondaryTextColor !== undefined) {
            this.secondaryTextColor = g10.secondaryTextColor;
        }
        if (g10.hoveringColor !== undefined) {
            this.hoveringColor = g10.hoveringColor;
        }
        if (g10.activedColor !== undefined) {
            this.activedColor = g10.activedColor;
        }
        if (g10.rowSpace !== undefined) {
            this.rowSpace = g10.rowSpace;
        }
        if (g10.iconTextFlag !== undefined) {
            this.iconTextFlag = g10.iconTextFlag;
        }
    }
    updateStateVars(f10) {
        this.__arrow.reset(f10.arrow);
        this.__icon.reset(f10.icon);
        this.__subIcon.reset(f10.subIcon);
        this.__button.reset(f10.button);
        this.__switch.reset(f10.switch);
        this.__checkBox.reset(f10.checkBox);
        this.__radio.reset(f10.radio);
        this.__image.reset(f10.image);
        this.__text.reset(f10.text);
        this.__rightWidth.reset(f10.rightWidth);
    }
    purgeVariableDependenciesOnElmtId(e10) {
        this.__arrow.purgeDependencyOnElmtId(e10);
        this.__icon.purgeDependencyOnElmtId(e10);
        this.__subIcon.purgeDependencyOnElmtId(e10);
        this.__button.purgeDependencyOnElmtId(e10);
        this.__switch.purgeDependencyOnElmtId(e10);
        this.__checkBox.purgeDependencyOnElmtId(e10);
        this.__radio.purgeDependencyOnElmtId(e10);
        this.__image.purgeDependencyOnElmtId(e10);
        this.__text.purgeDependencyOnElmtId(e10);
        this.__switchState.purgeDependencyOnElmtId(e10);
        this.__radioState.purgeDependencyOnElmtId(e10);
        this.__checkBoxState.purgeDependencyOnElmtId(e10);
        this.__rightWidth.purgeDependencyOnElmtId(e10);
        this.__secondaryTextColor.purgeDependencyOnElmtId(e10);
        this.__hoveringColor.purgeDependencyOnElmtId(e10);
        this.__activedColor.purgeDependencyOnElmtId(e10);
        this.__parentCanFocus.purgeDependencyOnElmtId(e10);
        this.__parentCanTouch.purgeDependencyOnElmtId(e10);
        this.__parentIsHover.purgeDependencyOnElmtId(e10);
        this.__parentCanHover.purgeDependencyOnElmtId(e10);
        this.__parentIsActive.purgeDependencyOnElmtId(e10);
        this.__parentFrontColor.purgeDependencyOnElmtId(e10);
        this.__parentDirection.purgeDependencyOnElmtId(e10);
        this.__isParentCanTouch.purgeDependencyOnElmtId(e10);
        this.__rowSpace.purgeDependencyOnElmtId(e10);
        this.__iconTextFlag.purgeDependencyOnElmtId(e10);
    }
    aboutToBeDeleted() {
        this.__arrow.aboutToBeDeleted();
        this.__icon.aboutToBeDeleted();
        this.__subIcon.aboutToBeDeleted();
        this.__button.aboutToBeDeleted();
        this.__switch.aboutToBeDeleted();
        this.__checkBox.aboutToBeDeleted();
        this.__radio.aboutToBeDeleted();
        this.__image.aboutToBeDeleted();
        this.__text.aboutToBeDeleted();
        this.__switchState.aboutToBeDeleted();
        this.__radioState.aboutToBeDeleted();
        this.__checkBoxState.aboutToBeDeleted();
        this.__rightWidth.aboutToBeDeleted();
        this.__secondaryTextColor.aboutToBeDeleted();
        this.__hoveringColor.aboutToBeDeleted();
        this.__activedColor.aboutToBeDeleted();
        this.__parentCanFocus.aboutToBeDeleted();
        this.__parentCanTouch.aboutToBeDeleted();
        this.__parentIsHover.aboutToBeDeleted();
        this.__parentCanHover.aboutToBeDeleted();
        this.__parentIsActive.aboutToBeDeleted();
        this.__parentFrontColor.aboutToBeDeleted();
        this.__parentDirection.aboutToBeDeleted();
        this.__isParentCanTouch.aboutToBeDeleted();
        this.__rowSpace.aboutToBeDeleted();
        this.__iconTextFlag.aboutToBeDeleted();
        SubscriberManager.Get().delete(this.id__());
        this.aboutToBeDeletedInternal();
    }
    get arrow() {
        return this.__arrow.get();
    }
    set arrow(d10) {
        this.__arrow.set(d10);
    }
    get icon() {
        return this.__icon.get();
    }
    set icon(c10) {
        this.__icon.set(c10);
    }
    get subIcon() {
        return this.__subIcon.get();
    }
    set subIcon(b10) {
        this.__subIcon.set(b10);
    }
    get button() {
        return this.__button.get();
    }
    set button(a10) {
        this.__button.set(a10);
    }
    get switch() {
        return this.__switch.get();
    }
    set switch(z9) {
        this.__switch.set(z9);
    }
    get checkBox() {
        return this.__checkBox.get();
    }
    set checkBox(y9) {
        this.__checkBox.set(y9);
    }
    get radio() {
        return this.__radio.get();
    }
    set radio(x9) {
        this.__radio.set(x9);
    }
    get image() {
        return this.__image.get();
    }
    set image(w9) {
        this.__image.set(w9);
    }
    get text() {
        return this.__text.get();
    }
    set text(v9) {
        this.__text.set(v9);
    }
    get switchState() {
        return this.__switchState.get();
    }
    set switchState(u9) {
        this.__switchState.set(u9);
    }
    get radioState() {
        return this.__radioState.get();
    }
    set radioState(t9) {
        this.__radioState.set(t9);
    }
    get checkBoxState() {
        return this.__checkBoxState.get();
    }
    set checkBoxState(s9) {
        this.__checkBoxState.set(s9);
    }
    get rightWidth() {
        return this.__rightWidth.get();
    }
    set rightWidth(r9) {
        this.__rightWidth.set(r9);
    }
    get secondaryTextColor() {
        return this.__secondaryTextColor.get();
    }
    set secondaryTextColor(q9) {
        this.__secondaryTextColor.set(q9);
    }
    get hoveringColor() {
        return this.__hoveringColor.get();
    }
    set hoveringColor(p9) {
        this.__hoveringColor.set(p9);
    }
    get activedColor() {
        return this.__activedColor.get();
    }
    set activedColor(o9) {
        this.__activedColor.set(o9);
    }
    get parentCanFocus() {
        return this.__parentCanFocus.get();
    }
    set parentCanFocus(n9) {
        this.__parentCanFocus.set(n9);
    }
    get parentCanTouch() {
        return this.__parentCanTouch.get();
    }
    set parentCanTouch(m9) {
        this.__parentCanTouch.set(m9);
    }
    get parentIsHover() {
        return this.__parentIsHover.get();
    }
    set parentIsHover(l9) {
        this.__parentIsHover.set(l9);
    }
    get parentCanHover() {
        return this.__parentCanHover.get();
    }
    set parentCanHover(k9) {
        this.__parentCanHover.set(k9);
    }
    get parentIsActive() {
        return this.__parentIsActive.get();
    }
    set parentIsActive(j9) {
        this.__parentIsActive.set(j9);
    }
    get parentFrontColor() {
        return this.__parentFrontColor.get();
    }
    set parentFrontColor(i9) {
        this.__parentFrontColor.set(i9);
    }
    get parentDirection() {
        return this.__parentDirection.get();
    }
    set parentDirection(h9) {
        this.__parentDirection.set(h9);
    }
    get isParentCanTouch() {
        return this.__isParentCanTouch.get();
    }
    set isParentCanTouch(g9) {
        this.__isParentCanTouch.set(g9);
    }
    get rowSpace() {
        return this.__rowSpace.get();
    }
    set rowSpace(f9) {
        this.__rowSpace.set(f9);
    }
    get iconTextFlag() {
        return this.__iconTextFlag.get();
    }
    set iconTextFlag(e9) {
        this.__iconTextFlag.set(e9);
    }
    onWillApplyTheme(d9) {
        this.secondaryTextColor = d9.colors.fontSecondary;
        this.hoveringColor = d9.colors.interactiveHover;
        this.activedColor = d9.colors.interactiveActive;
    }
    onPropChange() {
        if (this.switch != null) {
            this.switchState = this.switch.isCheck;
        }
        if (this.radio != null) {
            this.radioState = this.radio.isCheck;
        }
        if (this.checkBox != null) {
            this.checkBoxState = this.checkBox.isCheck;
        }
        if ((this.button == null && this.image == null && this.icon != null && this.text != null) ||
            (this.button == null && this.image == null && this.icon == null && this.arrow != null && this.text != null)) {
            this.rowSpace = SPECICAL_ROW_SPACE;
        }
        else {
            this.rowSpace = DEFAULT_ROW_SPACE;
        }
        if (this.icon != null && this.text != null) {
            this.iconTextFlag = true;
        }
    }
    aboutToAppear() {
        this.onPropChange();
    }
    createButton(o8 = null) {
        this.observeComponentCreation2((w8, x8) => {
            Button.createWithChild();
            Button.hitTestBehavior(HitTestMode.Block);
            Button.buttonStyle(ButtonStyleMode.NORMAL);
            Button.controlSize(ControlSize.SMALL);
            Button.constraintSize({
                minHeight: BUTTON_SIZE
            });
            Button.onFocus(() => {
                this.parentCanFocus = false;
            });
            Button.onTouch((c9) => {
                if (c9.type === TouchType.Down) {
                    this.parentCanTouch = false;
                }
                if (c9.type === TouchType.Up || c9.type === TouchType.Cancel) {
                    this.parentCanTouch = true;
                }
            });
            Button.onHover((b9) => {
                this.parentCanHover = false;
                if (b9 && this.parentFrontColor === this.hoveringColor) {
                    this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString();
                }
                if (!b9) {
                    this.parentCanHover = true;
                    if (this.parentIsHover) {
                        this.parentFrontColor = this.parentIsHover ? this.hoveringColor :
                            (this.parentIsActive ? this.activedColor : Color.Transparent.toString());
                    }
                }
            });
        }, Button);
        this.observeComponentCreation2((u8, v8) => {
            Row.create();
            Row.padding({
                left: { "id": -1, "type": 10002, params: ['sys.float.padding_level4'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
                right: { "id": -1, "type": 10002, params: ['sys.float.padding_level4'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }
            });
        }, Row);
        this.observeComponentCreation2((s8, t8) => {
            Text.create(this.button?.text);
            Text.focusable(true);
        }, Text);
        Text.pop();
        Row.pop();
        Button.pop();
    }
    createIcon(a8, b8 = null) {
        this.observeComponentCreation2((g8, h8) => {
            Button.createWithChild({ type: ButtonType.Normal });
            Button.margin({ start: LengthMetrics.vp(0), end: LengthMetrics.vp(this.getIconMarginEnd(a8.isSubIcon)) });
            Button.hitTestBehavior(HitTestMode.Block);
            Button.backgroundColor(Color.Transparent);
            Button.height(OPERATEITEM_ICON_CLICKABLE_SIZE);
            Button.width(OPERATEITEM_ICON_CLICKABLE_SIZE);
            Button.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
            Button.onFocus(() => {
                this.parentCanFocus = false;
            });
            Button.onTouch((n8) => {
                if (n8.type === TouchType.Down) {
                    this.parentCanTouch = false;
                }
                if (n8.type === TouchType.Up || n8.type === TouchType.Cancel) {
                    this.parentCanTouch = true;
                }
            });
            Button.onHover((m8) => {
                this.parentCanHover = false;
                if (m8 && this.parentFrontColor === this.hoveringColor) {
                    this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString();
                }
                if (!m8) {
                    this.parentCanHover = true;
                    if (this.parentIsHover) {
                        this.parentFrontColor = this.parentIsHover ? this.hoveringColor :
                            (this.parentIsActive ? this.activedColor : Color.Transparent.toString());
                    }
                }
            });
            Button.onAppear(() => {
                this.isParentCanTouch = true;
            });
            Button.onClick(a8.icon?.action);
            Button.flexShrink(0);
        }, Button);
        this.observeComponentCreation2((e8, f8) => {
            Image.create(a8.icon?.value);
            Image.height(OPERATEITEM_ICONLIKE_SIZE);
            Image.width(OPERATEITEM_ICONLIKE_SIZE);
            Image.focusable(true);
            Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.icon_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
            Image.draggable(false);
        }, Image);
        Button.pop();
    }
    getIconMarginEnd(z7) {
        if (this.icon !== null && this.subIcon !== null) {
            if (z7) {
                return OperateItemStruct.RIGHT_ITEM_OFFSET_LEVEL2;
            }
            else {
                return OperateItemStruct.RIGHT_ITEM_OFFSET_LEVEL1;
            }
        }
        else {
            return OperateItemStruct.RIGHT_ITEM_OFFSET_LEVEL2;
        }
    }
    createImage(u7 = null) {
        this.observeComponentCreation2((w7, x7) => {
            Image.create(this.image);
            Image.height(OPERATEITEM_IMAGE_SIZE);
            Image.width(OPERATEITEM_IMAGE_SIZE);
            Image.draggable(false);
            Image.onAppear(() => {
                this.isParentCanTouch = true;
            });
        }, Image);
    }
    createText(p7 = null) {
        this.observeComponentCreation2((r7, s7) => {
            Text.create(this.text);
            Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.Body_M'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
            Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor));
            Text.draggable(false);
            Text.flexShrink(1);
            Text.textAlign(this.parentDirection === FlexDirection.Column ? TextAlign.Start : TextAlign.End);
            Text.margin(this.parentDirection === FlexDirection.Column ? undefined : {
                top: TEXT_SAFE_MARGIN,
                bottom: TEXT_SAFE_MARGIN
            });
            Text.onAppear(() => {
                this.isParentCanTouch = true;
            });
        }, Text);
        Text.pop();
    }
    createArrow(c7 = null) {
        this.observeComponentCreation2((h7, i7) => {
            Button.createWithChild({ type: ButtonType.Normal });
            Button.hitTestBehavior(HitTestMode.Transparent);
            Button.backgroundColor(Color.Transparent);
            Button.height(OPERATEITEM_ICONLIKE_SIZE);
            Button.width(OPERATEITEM_ARROW_WIDTH);
            Button.onFocus(() => {
                this.parentCanFocus = false;
            });
            Button.stateEffect(this.arrow?.action !== undefined);
            Button.onTouch((o7) => {
                if (this.arrow?.action === undefined) {
                    return;
                }
                if (o7.type === TouchType.Down) {
                    this.parentCanTouch = false;
                }
                if (o7.type === TouchType.Up || o7.type === TouchType.Cancel) {
                    this.parentCanTouch = true;
                }
            });
            Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None);
            Button.onHover((n7) => {
                if (this.arrow?.action === undefined) {
                    return;
                }
                this.parentCanHover = false;
                if (n7) {
                    this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString();
                }
                if (!n7) {
                    this.parentCanHover = true;
                    if (this.parentIsHover) {
                        this.parentFrontColor = this.parentIsHover ? this.hoveringColor :
                            (this.parentIsActive ? this.activedColor : Color.Transparent.toString());
                    }
                }
            });
            Button.onAppear(() => {
                this.isParentCanTouch = true;
            });
            Button.onClick(this.arrow?.action);
        }, Button);
        this.observeComponentCreation2((f7, g7) => {
            Image.create(this.arrow?.value);
            Image.height(OPERATEITEM_ICONLIKE_SIZE);
            Image.width(OPERATEITEM_ARROW_WIDTH);
            Image.focusable(true);
            Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.icon_fourth'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
            Image.draggable(false);
            Image.matchTextDirection(true);
        }, Image);
        Button.pop();
    }
    createRadio(s6 = null) {
        this.observeComponentCreation2((u6, v6) => {
            Radio.create({ value: '', group: '' });
            Radio.margin({ end: LengthMetrics.vp(OperateItemStruct.RIGHT_ITEM_OFFSET_LEVEL1) });
            Radio.checked(this.radioState);
            Radio.onChange(this.radio?.onChange);
            Radio.height(OPERATEITEM_ICONLIKE_SIZE);
            Radio.width(OPERATEITEM_ICONLIKE_SIZE);
            Radio.onFocus(() => {
                this.parentCanFocus = false;
            });
            Radio.hitTestBehavior(HitTestMode.Block);
            Radio.onTouch((b7) => {
                if (b7.type === TouchType.Down) {
                    this.parentCanTouch = false;
                }
                if (b7.type === TouchType.Up || b7.type === TouchType.Cancel) {
                    this.parentCanTouch = true;
                }
            });
            Radio.onHover((a7) => {
                this.parentCanHover = false;
                if (a7 && this.parentFrontColor === this.hoveringColor) {
                    this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString();
                }
                if (!a7) {
                    this.parentCanHover = true;
                    if (this.parentIsHover) {
                        this.parentFrontColor = this.parentIsHover ? this.hoveringColor :
                            (this.parentIsActive ? this.activedColor : Color.Transparent.toString());
                    }
                }
            });
            Radio.onAppear(() => {
                this.isParentCanTouch = true;
            });
        }, Radio);
    }
    createCheckBox(i6 = null) {
        this.observeComponentCreation2((k6, l6) => {
            Checkbox.create();
            Checkbox.margin({ end: LengthMetrics.vp(OperateItemStruct.RIGHT_ITEM_OFFSET_LEVEL1) });
            Checkbox.select(this.checkBoxState);
            Checkbox.onChange(this.checkBox?.onChange);
            Checkbox.height(OPERATEITEM_ICONLIKE_SIZE);
            Checkbox.width(OPERATEITEM_ICONLIKE_SIZE);
            Checkbox.onFocus(() => {
                this.parentCanFocus = false;
            });
            Checkbox.hitTestBehavior(HitTestMode.Block);
            Checkbox.onTouch((r6) => {
                if (r6.type === TouchType.Down) {
                    this.parentCanTouch = false;
                }
                if (r6.type === TouchType.Up || r6.type === TouchType.Cancel) {
                    this.parentCanTouch = true;
                }
            });
            Checkbox.onHover((q6) => {
                this.parentCanHover = false;
                if (q6 && this.parentFrontColor === this.hoveringColor) {
                    this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString();
                }
                if (!q6) {
                    this.parentCanHover = true;
                    if (this.parentIsHover) {
                        this.parentFrontColor = this.parentIsHover ? this.hoveringColor :
                            (this.parentIsActive ? this.activedColor : Color.Transparent.toString());
                    }
                }
            });
            Checkbox.onAppear(() => {
                this.isParentCanTouch = true;
            });
        }, Checkbox);
        Checkbox.pop();
    }
    createSwitch(v5 = null) {
        this.observeComponentCreation2((b6, c6) => {
            Row.create();
            Row.height(OPERATEITEM_ICON_CLICKABLE_SIZE);
            Row.width(OPERATEITEM_ICON_CLICKABLE_SIZE);
            Row.justifyContent(FlexAlign.Center);
            Row.onFocus(() => {
                this.parentCanFocus = false;
            });
            Row.onTouch((h6) => {
                if (h6.type === TouchType.Down) {
                    this.parentCanTouch = false;
                }
                if (h6.type === TouchType.Up || h6.type === TouchType.Cancel) {
                    this.parentCanTouch = true;
                }
            });
            Row.onHover((g6) => {
                this.parentCanHover = false;
                if (g6 && this.parentFrontColor === this.hoveringColor) {
                    this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString();
                }
                if (!g6) {
                    this.parentCanHover = true;
                    if (this.parentIsHover) {
                        this.parentFrontColor = this.parentIsHover ? this.hoveringColor :
                            (this.parentIsActive ? this.activedColor : Color.Transparent.toString());
                    }
                }
            });
        }, Row);
        this.observeComponentCreation2((y5, z5) => {
            Toggle.create({ type: ToggleType.Switch, isOn: this.switchState });
            Toggle.onChange(this.switch?.onChange);
            Toggle.onClick(() => {
                this.switchState = !this.switchState;
            });
            Toggle.hitTestBehavior(HitTestMode.Block);
        }, Toggle);
        Toggle.pop();
        Row.pop();
    }
    createTextArrow(o4 = null) {
        this.observeComponentCreation2((n5, o5) => {
            Button.createWithChild({ type: ButtonType.Normal });
            Button.hitTestBehavior(HitTestMode.Transparent);
            Button.backgroundColor(Color.Transparent);
            Button.constraintSize({ minHeight: TEXT_ARROW_HEIGHT });
            Button.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
            Button.onFocus(() => {
                this.parentCanFocus = false;
            });
            Button.padding({
                top: 0,
                bottom: 0,
                left: 0,
                right: 0
            });
            Button.stateEffect(this.arrow?.action !== undefined);
            Button.onTouch((u5) => {
                if (this.arrow?.action === undefined) {
                    return;
                }
                if (u5.type === TouchType.Down) {
                    this.parentCanTouch = false;
                }
                if (u5.type === TouchType.Up || u5.type === TouchType.Cancel) {
                    this.parentCanTouch = true;
                }
            });
            Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None);
            Button.onHover((t5) => {
                if (this.arrow?.action === undefined) {
                    return;
                }
                this.parentCanHover = false;
                if (t5) {
                    this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString();
                }
                if (!t5) {
                    this.parentCanHover = true;
                    if (this.parentIsHover) {
                        this.parentFrontColor = this.parentIsHover ? this.hoveringColor :
                            (this.parentIsActive ? this.activedColor : Color.Transparent.toString());
                    }
                }
            });
            Button.onAppear(() => {
                this.isParentCanTouch = true;
            });
            Button.onClick(this.arrow?.action);
        }, Button);
        this.observeComponentCreation2((r4, s4) => {
            If.create();
            if (this.parentDirection === FlexDirection.Column) {
                this.ifElseBranchUpdateFunction(0, () => {
                    this.observeComponentCreation2((l5, m5) => {
                        Flex.create({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center });
                    }, Flex);
                    this.observeComponentCreation2((j5, k5) => {
                        Text.create(this.text);
                        Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.Body_M'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                        Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor));
                        Text.focusable(true);
                        Text.draggable(false);
                    }, Text);
                    Text.pop();
                    this.observeComponentCreation2((h5, i5) => {
                        Image.create(this.arrow?.value);
                        Image.height(OPERATEITEM_ICONLIKE_SIZE);
                        Image.width(OPERATEITEM_ARROW_WIDTH);
                        Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.icon_fourth'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                        Image.focusable(false);
                        Image.draggable(false);
                    }, Image);
                    Flex.pop();
                });
            }
            else {
                this.ifElseBranchUpdateFunction(1, () => {
                    this.observeComponentCreation2((b5, c5) => {
                        Flex.create({ justifyContent: FlexAlign.End, alignItems: ItemAlign.Center });
                    }, Flex);
                    this.observeComponentCreation2((z4, a5) => {
                        Text.create(this.text);
                        Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.Body_M'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                        Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor));
                        Text.focusable(true);
                        Text.draggable(false);
                        Text.textAlign(TextAlign.End);
                        Text.margin({
                            top: TEXT_SAFE_MARGIN,
                            bottom: TEXT_SAFE_MARGIN
                        });
                    }, Text);
                    Text.pop();
                    this.observeComponentCreation2((x4, y4) => {
                        Image.create(this.arrow?.value);
                        Image.height(OPERATEITEM_ICONLIKE_SIZE);
                        Image.width(OPERATEITEM_ARROW_WIDTH);
                        Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.icon_fourth'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
                        Image.focusable(false);
                        Image.draggable(false);
                        Image.matchTextDirection(true);
                    }, Image);
                    Flex.pop();
                });
            }
        }, If);
        If.pop();
        Button.pop();
    }
    getFlexOptions() {
        let n4 = { alignItems: ItemAlign.Center };
        if (this.parentDirection === FlexDirection.Column) {
            n4.justifyContent = FlexAlign.SpaceBetween;
        }
        else {
            n4.space = { main: LengthMetrics.vp(this.rowSpace) };
            n4.justifyContent = FlexAlign.End;
        }
        return n4;
    }
    initialRender() {
        this.observeComponentCreation2((l4, m4) => {
            Flex.create(this.getFlexOptions());
            Flex.width(this.parentDirection === FlexDirection.Column ? undefined : this.rightWidth);
        }, Flex);
        this.observeComponentCreation2((q3, r3) => {
            If.create();
            if (this.button != null) {
                this.ifElseBranchUpdateFunction(0, () => {
                    this.createButton.bind(this)();
                });
            }
            else if (this.image != null) {
                this.ifElseBranchUpdateFunction(1, () => {
                    this.createImage.bind(this)();
                });
            }
            else if (this.icon != null && this.text != null) {
                this.ifElseBranchUpdateFunction(2, () => {
                    this.observeComponentCreation2((h4, i4) => {
                        Flex.create({
                            justifyContent: this.parentDirection === FlexDirection.Column ? FlexAlign.SpaceBetween : FlexAlign.End,
                            alignItems: ItemAlign.Center
                        });
                    }, Flex);
                    this.createText.bind(this)();
                    this.createIcon.bind(this)(makeBuilderParameterProxy("createIcon", { icon: () => (this["__icon"] ? this["__icon"] : this["icon"]), isSubIcon: () => false }));
                    Flex.pop();
                });
            }
            else if (this.arrow != null && this.text == null) {
                this.ifElseBranchUpdateFunction(3, () => {
                    this.createArrow.bind(this)();
                });
            }
            else if (this.arrow != null && this.text != null) {
                this.ifElseBranchUpdateFunction(4, () => {
                    this.createTextArrow.bind(this)();
                });
            }
            else if (this.text != null) {
                this.ifElseBranchUpdateFunction(5, () => {
                    this.createText.bind(this)();
                });
            }
            else if (this.radio != null) {
                this.ifElseBranchUpdateFunction(6, () => {
                    this.createRadio.bind(this)();
                });
            }
            else if (this.checkBox != null) {
                this.ifElseBranchUpdateFunction(7, () => {
                    this.createCheckBox.bind(this)();
                });
            }
            else if (this.switch != null) {
                this.ifElseBranchUpdateFunction(8, () => {
                    this.createSwitch.bind(this)();
                });
            }
            else if (this.icon != null) {
                this.ifElseBranchUpdateFunction(9, () => {
                    this.createIcon.bind(this)(makeBuilderParameterProxy("createIcon", { icon: () => (this["__icon"] ? this["__icon"] : this["icon"]), isSubIcon: () => false }));
                    this.observeComponentCreation2((v3, w3) => {
                        If.create();
                        if (this.subIcon != null) {
                            this.ifElseBranchUpdateFunction(0, () => {
                                this.createIcon.bind(this)(makeBuilderParameterProxy("createIcon", { icon: () => (this["__subIcon"] ? this["__subIcon"] : this["subIcon"]), isSubIcon: () => true }));
                            });
                        }
                        else {
                            this.ifElseBranchUpdateFunction(1, () => {
                            });
                        }
                    }, If);
                    If.pop();
                });
            }
            else {
                this.ifElseBranchUpdateFunction(10, () => {
                });
            }
        }, If);
        If.pop();
        Flex.pop();
    }
    rerender() {
        this.updateDirtyElements();
    }
}
OperateItemStruct.RIGHT_ITEM_OFFSET_LEVEL1 = 0;
OperateItemStruct.RIGHT_ITEM_OFFSET_LEVEL2 = -8;
export class ComposeListItem extends ViewPU {
    constructor(i3, j3, k3, l3 = -1, m3 = undefined, n3) {
        super(i3, k3, l3, n3);
        if (typeof m3 === "function") {
            this.paramsGenerator_ = m3;
        }
        this.__contentItem = new SynchedPropertyObjectOneWayPU(j3.contentItem, this, "contentItem");
        this.__operateItem = new SynchedPropertyObjectOneWayPU(j3.operateItem, this, "operateItem");
        this.__itemSpace = new SynchedPropertySimpleOneWayPU(j3.itemSpace, this, "itemSpace");
        this.__composeItemPadding = new SynchedPropertyObjectOneWayPU(j3.composeItemPadding, this, "composeItemPadding");
        this.__frontColor = new ObservedPropertyObjectPU(Color.Transparent.toString(), this, "frontColor");
        this.__borderSize = new ObservedPropertySimplePU(0, this, "borderSize");
        this.__canFocus = new ObservedPropertySimplePU(false, this, "canFocus");
        this.__canTouch = new ObservedPropertySimplePU(true, this, "canTouch");
        this.__canHover = new ObservedPropertySimplePU(true, this, "canHover");
        this.__isHover = new ObservedPropertySimplePU(true, this, "isHover");
        this.__itemHeight = new ObservedPropertySimplePU(ItemHeight.FIRST_HEIGHT, this, "itemHeight");
        this.__isActive = new ObservedPropertySimplePU(false, this, "isActive");
        this.__hoveringColor = new ObservedPropertyObjectPU('#0d000000', this, "hoveringColor");
        this.__touchDownColor = new ObservedPropertyObjectPU('#1a000000', this, "touchDownColor");
        this.__activedColor = new ObservedPropertyObjectPU('#1a0a59f7', this, "activedColor");
        this.__focusOutlineColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_focused_outline'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "focusOutlineColor");
        this.__fontSizeScale = new ObservedPropertySimplePU(1, this, "fontSizeScale");
        this.__containerDirection = new ObservedPropertySimplePU(FlexDirection.Row, this, "containerDirection");
        this.__contentItemDirection = new ObservedPropertySimplePU(FlexDirection.Row, this, "contentItemDirection");
        this.__containerPadding = new ObservedPropertyObjectPU(undefined, this, "containerPadding");
        this.isFollowingSystemFontScale = this.getUIContext().isFollowingSystemFontScale();
        this.maxFontScale = this.getUIContext().getMaxFontScale();
        this.__isCanTouch = new ObservedPropertySimplePU(false, this, "isCanTouch");
        this.setInitiallyProvidedValue(j3);
        this.declareWatch("contentItem", this.onPropChange);
        this.declareWatch("operateItem", this.onPropChange);
        this.declareWatch("fontSizeScale", this.onFontSizeScaleChange);
        this.finalizeConstruction();
    }
    setInitiallyProvidedValue(h3) {
        if (h3.contentItem === undefined) {
            this.__contentItem.set(null);
        }
        if (h3.operateItem === undefined) {
            this.__operateItem.set(null);
        }
        if (h3.itemSpace === undefined) {
            this.__itemSpace.set(DEFAULT_ITEM_SPACE_WIDTH);
        }
        if (h3.composeItemPadding === undefined) {
            this.__composeItemPadding.set(null);
        }
        if (h3.frontColor !== undefined) {
            this.frontColor = h3.frontColor;
        }
        if (h3.borderSize !== undefined) {
            this.borderSize = h3.borderSize;
        }
        if (h3.canFocus !== undefined) {
            this.canFocus = h3.canFocus;
        }
        if (h3.canTouch !== undefined) {
            this.canTouch = h3.canTouch;
        }
        if (h3.canHover !== undefined) {
            this.canHover = h3.canHover;
        }
        if (h3.isHover !== undefined) {
            this.isHover = h3.isHover;
        }
        if (h3.itemHeight !== undefined) {
            this.itemHeight = h3.itemHeight;
        }
        if (h3.isActive !== undefined) {
            this.isActive = h3.isActive;
        }
        if (h3.hoveringColor !== undefined) {
            this.hoveringColor = h3.hoveringColor;
        }
        if (h3.touchDownColor !== undefined) {
            this.touchDownColor = h3.touchDownColor;
        }
        if (h3.activedColor !== undefined) {
            this.activedColor = h3.activedColor;
        }
        if (h3.focusOutlineColor !== undefined) {
            this.focusOutlineColor = h3.focusOutlineColor;
        }
        if (h3.fontSizeScale !== undefined) {
            this.fontSizeScale = h3.fontSizeScale;
        }
        if (h3.containerDirection !== undefined) {
            this.containerDirection = h3.containerDirection;
        }
        if (h3.contentItemDirection !== undefined) {
            this.contentItemDirection = h3.contentItemDirection;
        }
        if (h3.containerPadding !== undefined) {
            this.containerPadding = h3.containerPadding;
        }
        if (h3.isFollowingSystemFontScale !== undefined) {
            this.isFollowingSystemFontScale = h3.isFollowingSystemFontScale;
        }
        if (h3.maxFontScale !== undefined) {
            this.maxFontScale = h3.maxFontScale;
        }
        if (h3.isCanTouch !== undefined) {
            this.isCanTouch = h3.isCanTouch;
        }
    }
    updateStateVars(g3) {
        this.__contentItem.reset(g3.contentItem);
        this.__operateItem.reset(g3.operateItem);
        this.__itemSpace.reset(g3.itemSpace);
        this.__composeItemPadding.reset(g3.composeItemPadding);
    }
    purgeVariableDependenciesOnElmtId(f3) {
        this.__contentItem.purgeDependencyOnElmtId(f3);
        this.__operateItem.purgeDependencyOnElmtId(f3);
        this.__itemSpace.purgeDependencyOnElmtId(f3);
        this.__composeItemPadding.purgeDependencyOnElmtId(f3);
        this.__frontColor.purgeDependencyOnElmtId(f3);
        this.__borderSize.purgeDependencyOnElmtId(f3);
        this.__canFocus.purgeDependencyOnElmtId(f3);
        this.__canTouch.purgeDependencyOnElmtId(f3);
        this.__canHover.purgeDependencyOnElmtId(f3);
        this.__isHover.purgeDependencyOnElmtId(f3);
        this.__itemHeight.purgeDependencyOnElmtId(f3);
        this.__isActive.purgeDependencyOnElmtId(f3);
        this.__hoveringColor.purgeDependencyOnElmtId(f3);
        this.__touchDownColor.purgeDependencyOnElmtId(f3);
        this.__activedColor.purgeDependencyOnElmtId(f3);
        this.__focusOutlineColor.purgeDependencyOnElmtId(f3);
        this.__fontSizeScale.purgeDependencyOnElmtId(f3);
        this.__containerDirection.purgeDependencyOnElmtId(f3);
        this.__contentItemDirection.purgeDependencyOnElmtId(f3);
        this.__containerPadding.purgeDependencyOnElmtId(f3);
        this.__isCanTouch.purgeDependencyOnElmtId(f3);
    }
    aboutToBeDeleted() {
        this.__contentItem.aboutToBeDeleted();
        this.__operateItem.aboutToBeDeleted();
        this.__itemSpace.aboutToBeDeleted();
        this.__composeItemPadding.aboutToBeDeleted();
        this.__frontColor.aboutToBeDeleted();
        this.__borderSize.aboutToBeDeleted();
        this.__canFocus.aboutToBeDeleted();
        this.__canTouch.aboutToBeDeleted();
        this.__canHover.aboutToBeDeleted();
        this.__isHover.aboutToBeDeleted();
        this.__itemHeight.aboutToBeDeleted();
        this.__isActive.aboutToBeDeleted();
        this.__hoveringColor.aboutToBeDeleted();
        this.__touchDownColor.aboutToBeDeleted();
        this.__activedColor.aboutToBeDeleted();
        this.__focusOutlineColor.aboutToBeDeleted();
        this.__fontSizeScale.aboutToBeDeleted();
        this.__containerDirection.aboutToBeDeleted();
        this.__contentItemDirection.aboutToBeDeleted();
        this.__containerPadding.aboutToBeDeleted();
        this.__isCanTouch.aboutToBeDeleted();
        SubscriberManager.Get().delete(this.id__());
        this.aboutToBeDeletedInternal();
    }
    get contentItem() {
        return this.__contentItem.get();
    }
    set contentItem(e3) {
        this.__contentItem.set(e3);
    }
    get operateItem() {
        return this.__operateItem.get();
    }
    set operateItem(d3) {
        this.__operateItem.set(d3);
    }
    get itemSpace() {
        return this.__itemSpace.get();
    }
    set itemSpace(c3) {
        this.__itemSpace.set(c3);
    }
    get composeItemPadding() {
        return this.__composeItemPadding.get();
    }
    set composeItemPadding(b3) {
        this.__composeItemPadding.set(b3);
    }
    get frontColor() {
        return this.__frontColor.get();
    }
    set frontColor(a3) {
        this.__frontColor.set(a3);
    }
    get borderSize() {
        return this.__borderSize.get();
    }
    set borderSize(z2) {
        this.__borderSize.set(z2);
    }
    get canFocus() {
        return this.__canFocus.get();
    }
    set canFocus(y2) {
        this.__canFocus.set(y2);
    }
    get canTouch() {
        return this.__canTouch.get();
    }
    set canTouch(x2) {
        this.__canTouch.set(x2);
    }
    get canHover() {
        return this.__canHover.get();
    }
    set canHover(w2) {
        this.__canHover.set(w2);
    }
    get isHover() {
        return this.__isHover.get();
    }
    set isHover(v2) {
        this.__isHover.set(v2);
    }
    get itemHeight() {
        return this.__itemHeight.get();
    }
    set itemHeight(u2) {
        this.__itemHeight.set(u2);
    }
    get isActive() {
        return this.__isActive.get();
    }
    set isActive(t2) {
        this.__isActive.set(t2);
    }
    get hoveringColor() {
        return this.__hoveringColor.get();
    }
    set hoveringColor(s2) {
        this.__hoveringColor.set(s2);
    }
    get touchDownColor() {
        return this.__touchDownColor.get();
    }
    set touchDownColor(r2) {
        this.__touchDownColor.set(r2);
    }
    get activedColor() {
        return this.__activedColor.get();
    }
    set activedColor(q2) {
        this.__activedColor.set(q2);
    }
    get focusOutlineColor() {
        return this.__focusOutlineColor.get();
    }
    set focusOutlineColor(p2) {
        this.__focusOutlineColor.set(p2);
    }
    get fontSizeScale() {
        return this.__fontSizeScale.get();
    }
    set fontSizeScale(o2) {
        this.__fontSizeScale.set(o2);
    }
    get containerDirection() {
        return this.__containerDirection.get();
    }
    set containerDirection(n2) {
        this.__containerDirection.set(n2);
    }
    get contentItemDirection() {
        return this.__contentItemDirection.get();
    }
    set contentItemDirection(m2) {
        this.__contentItemDirection.set(m2);
    }
    get containerPadding() {
        return this.__containerPadding.get();
    }
    set containerPadding(l2) {
        this.__containerPadding.set(l2);
    }
    get isCanTouch() {
        return this.__isCanTouch.get();
    }
    set isCanTouch(k2) {
        this.__isCanTouch.set(k2);
    }
    onWillApplyTheme(j2) {
        this.hoveringColor = j2.colors.interactiveHover;
        this.touchDownColor = j2.colors.interactivePressed;
        this.activedColor = j2.colors.interactiveActive;
        this.focusOutlineColor = j2.colors.interactiveFocus;
    }
    onPropChange() {
        if (this.contentItem === undefined) {
            if (this.operateItem?.image !== undefined ||
                this.operateItem?.icon !== undefined ||
                this.operateItem?.subIcon !== undefined) {
                this.itemHeight = OPERATEITEM_IMAGE_SIZE + SAFE_LIST_PADDING;
            }
            return;
        }
        if (this.contentItem?.secondaryText === undefined && this.contentItem?.description === undefined) {
            if (this.contentItem?.icon === undefined) {
                this.itemHeight = ItemHeight.FIRST_HEIGHT;
            }
            else {
                this.itemHeight = this.contentItem.iconStyle <= IconType.HEAD_SCULPTURE ?
                ItemHeight.SECOND_HEIGHT : ItemHeight.THIRD_HEIGHT;
            }
        }
        else if (this.contentItem.description === undefined) {
            if (this.contentItem.icon === undefined ||
                (this.contentItem.icon !== undefined && this.contentItem.iconStyle <= IconType.SYSTEM_ICON)) {
                this.itemHeight = ItemHeight.THIRD_HEIGHT;
            }
            else {
                this.itemHeight = ItemHeight.FOURTH_HEIGHT;
            }
        }
        else {
            this.itemHeight = ItemHeight.FIFTH_HEIGHT;
        }
        if (ICON_SIZE_MAP.get(this.contentItem?.iconStyle) >= this.itemHeight) {
            this.itemHeight = ICON_SIZE_MAP.get(this.contentItem?.iconStyle) + SAFE_LIST_PADDING;
        }
    }
    aboutToAppear() {
        this.onPropChange();
    }
    calculatedLeftWidth() {
        if (this.operateItem === null || JSON.stringify(this.operateItem) === '{}') {
            return RIGHT_CONTENT_NULL_LEFTWIDTH;
        }
        else if (this.operateItem?.switch != null && this.operateItem?.text == null) {
            return LEFT_ONLY_SWITCH_WIDTH;
        }
        else if (this.operateItem?.checkbox != null && this.operateItem?.text == null) {
            return LEFT_ONLY_CHECKBOX_WIDTH;
        }
        else if (this.operateItem?.radio != null && this.operateItem?.text == null) {
            return LEFT_ONLY_RADIO_WIDTH;
        }
        else if (this.operateItem?.icon != null && this.operateItem?.text == null) {
            if (this.operateItem?.subIcon != null) {
                return LEFT_ICON_SUB_ICON_WIDTH;
            }
            return LEFT_ONLY_ICON_WIDTH;
        }
        else if (this.operateItem?.image != null && this.operateItem?.text == null) {
            return LEFT_ONLY_IMAGE_WIDTH;
        }
        else if (this.operateItem?.arrow != null && this.operateItem?.text == null) {
            return LEFT_ONLY_ARROW_WIDTH;
        }
        else {
            return LEFT_PART_WIDTH;
        }
    }
    calculatedRightWidth() {
        if (this.operateItem === null || JSON.stringify(this.operateItem) === '{}') {
            return RIGHT_CONTENT_NULL_RIGHTWIDTH;
        }
        else if (this.operateItem?.switch != null && this.operateItem?.text == null) {
            return RIGHT_ONLY_SWITCH_WIDTH;
        }
        else if (this.operateItem?.checkbox != null && this.operateItem?.text == null) {
            return RIGHT_ONLY_CHECKBOX_WIDTH;
        }
        else if (this.operateItem?.radio != null && this.operateItem?.text == null) {
            return RIGHT_ONLY_RADIO_WIDTH;
        }
        else if (this.operateItem?.icon != null && this.operateItem?.text == null) {
            if (this.operateItem?.subIcon != null) {
                return RIGHT_ICON_SUB_ICON_WIDTH;
            }
            return RIGHT_ONLY_ICON_WIDTH;
        }
        else if (this.operateItem?.image != null && this.operateItem?.text == null) {
            return RIGHT_ONLY_IMAGE_WIDTH;
        }
        else if (this.operateItem?.arrow != null && this.operateItem?.text == null) {
            return RIGHT_ONLY_ARROW_WIDTH;
        }
        else {
            return RIGHT_PART_WIDTH;
        }
    }
    getRightPadding() {
        if (this.composeItemPadding !== null && this.composeItemPadding?.end !== undefined) {
            return this.composeItemPadding?.end?.value;
        }
        return DEFAULT_STACK_PADDING;
    }
    decideContentItemDirection() {
        if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL1 &&
            this.contentItem?.iconStyle && this.contentItem?.iconStyle > IconType.HEAD_SCULPTURE) {
            return FlexDirection.Column;
        }
        return FlexDirection.Row;
    }
    decideContainerDirection() {
        if (this.fontSizeScale < FontSizeScaleLevel.LEVEL1 || !this.contentItem) {
            return FlexDirection.Row;
        }
        if (this.operateItem?.button) {
            return FlexDirection.Column;
        }
        else if (this.operateItem?.image) {
            return FlexDirection.Row;
        }
        else if (this.operateItem?.icon && this.operateItem?.text) {
            return FlexDirection.Column;
        }
        else if (this.operateItem?.arrow) {
            if (!this.operateItem?.text) {
                return FlexDirection.Row;
            }
            return FlexDirection.Column;
        }
        else if (this.operateItem?.text) {
            return FlexDirection.Column;
        }
        else {
            return FlexDirection.Row;
        }
    }
    onFontSizeScaleChange() {
        this.containerDirection = this.decideContainerDirection();
        this.contentItemDirection = this.decideContentItemDirection();
        if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL3) {
            this.containerPadding = {
                top: { "id": -1, "type": 10002, params: ['sys.float.padding_level12'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
                bottom: { "id": -1, "type": 10002, params: ['sys.float.padding_level12'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
            };
        }
        else if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL2) {
            this.containerPadding = {
                top: { "id": -1, "type": 10002, params: ['sys.float.padding_level10'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
                bottom: { "id": -1, "type": 10002, params: ['sys.float.padding_level10'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
            };
        }
        else if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL1) {
            this.containerPadding = {
                top: { "id": -1, "type": 10002, params: ['sys.float.padding_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
                bottom: { "id": -1, "type": 10002, params: ['sys.float.padding_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
            };
        }
        else {
            this.containerPadding = undefined;
        }
    }
    isSingleLine() {
        return !this.contentItem?.secondaryText && !this.contentItem?.description;
    }
    getItemSpace() {
        return LengthMetrics.vp(this.itemSpace ?? DEFAULT_ITEM_SPACE_WIDTH);
    }
    getOperateOffset() {
        if (this.containerDirection === FlexDirection.Row) {
            return LengthMetrics.vp(0);
        }
        let i2 = ICON_SIZE_MAP.get(this.contentItem?.iconStyle);
        if (this.contentItem?.icon && i2 && i2 <= HEADSCULPTURE_SIZE) {
            return LengthMetrics.vp(i2 + this.getItemSpace().value);
        }
        return LengthMetrics.vp(0);
    }
    getMainSpace() {
        if (this.containerDirection === FlexDirection.Column) {
            return LengthMetrics.resource(this.isSingleLine() ? { "id": -1, "type": 10002, params: ['sys.float.padding_level1'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" } : { "id": -1, "type": 10002, params: ['sys.float.padding_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
        }
        return LengthMetrics.vp(0);
    }
    getFlexOptions() {
        if (this.containerDirection === FlexDirection.Column) {
            return {
                space: { main: this.getMainSpace() },
                justifyContent: FlexAlign.Center,
                alignItems: ItemAlign.Start,
                direction: this.containerDirection,
            };
        }
        return {
            justifyContent: FlexAlign.SpaceBetween,
            alignItems: ItemAlign.Center,
            direction: this.containerDirection,
        };
    }
    decideFontSizeScale() {
        if (!this.isFollowingSystemFontScale) {
            return 1;
        }
        return Math.min(this.maxFontScale, this.getUIContext().getHostContext()?.config.fontSizeScale ?? 1);
    }
    onMeasureSize(b2, c2, d2) {
        this.fontSizeScale = this.decideFontSizeScale();
        let e2 = { height: 0, width: 0 };
        c2.forEach((g2) => {
            let h2 = g2.measure(d2);
            e2.width = h2.width;
            e2.height = h2.height;
        });
        return e2;
    }
    initialRender() {
        this.observeComponentCreation2((z1, a2) => {
            Stack.create();
            Stack.clip(true);
            Stack.padding({
                start: this.getComposeItemLeftPadding(),
                end: this.getComposeItemRightPadding()
            });
        }, Stack);
        this.observeComponentCreation2((r1, s1) => {
            Flex.create(this.getFlexOptions());
            Flex.constraintSize({
                minHeight: this.itemHeight
            });
            Flex.focusable(true);
            Flex.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_default_m'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
            Flex.backgroundColor(ObservedObject.GetRawObject(this.frontColor));
            Flex.onFocus(() => {
                this.canFocus = true;
            });
            Flex.onBlur(() => {
                this.canFocus = false;
            });
            Flex.onHover((y1) => {
                this.isHover = y1;
                if (this.canHover) {
                    this.frontColor = y1 ? this.hoveringColor :
                        (this.isActive ? this.activedColor : Color.Transparent.toString());
                }
            });
            Flex.onTouch((x1) => {
                if (this.isCanTouch) {
                    if (x1.type === TouchType.Down && this.canTouch) {
                        this.frontColor = this.touchDownColor;
                    }
                    if (x1.type === TouchType.Up || x1.type === TouchType.Cancel) {
                        this.frontColor = this.isActive ? this.activedColor : Color.Transparent.toString();
                    }
                }
            });
            ViewStackProcessor.visualState("focused");
            Flex.border({
                radius: { "id": -1, "type": 10002, params: ['sys.float.corner_radius_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
                width: { left: this.getFlexLeftOutlineWidth(), right: this.getFlexRightOutlineWidth() },
                color: Color.Transparent
            });
            Flex.outline({
                radius: { "id": -1, "type": 10002, params: ['sys.float.corner_radius_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
                width: ITEM_BORDER_SHOWN,
                color: this.focusOutlineColor,
                style: OutlineStyle.SOLID
            });
            ViewStackProcessor.visualState("normal");
            Flex.border({
                radius: { "id": -1, "type": 10002, params: ['sys.float.corner_radius_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
                width: { left: this.getFlexLeftOutlineWidth(), right: this.getFlexRightOutlineWidth() },
                color: Color.Transparent
            });
            Flex.outline({
                radius: { "id": -1, "type": 10002, params: ['sys.float.corner_radius_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" },
                width: 0,
                color: Color.Transparent,
                style: OutlineStyle.SOLID
            });
            ViewStackProcessor.visualState();
            Flex.padding(ObservedObject.GetRawObject(this.containerPadding));
        }, Flex);
        this.observeComponentCreation2((g1, h1) => {
            If.create();
            if (this.contentItem === null) {
                this.ifElseBranchUpdateFunction(0, () => {
                    {
                        this.observeComponentCreation2((l1, m1) => {
                            if (m1) {
                                let n1 = new ContentItemStruct(this, {}, undefined, l1, () => { }, { page: "librarys/composelistitem/src/main/ets/components/composelistitem.ets", line: 1030, col: 11 });
                                ViewPU.create(n1);
                                let o1 = () => {
                                    return {};
                                };
                                n1.paramsGenerator_ = o1;
                            }
                            else {
                                this.updateStateVarsOfChildByElmtId(l1, {});
                            }
                        }, { name: "ContentItemStruct" });
                    }
                });
            }
            else {
                this.ifElseBranchUpdateFunction(1, () => {
                });
            }
        }, If);
        If.pop();
        this.observeComponentCreation2((v, w) => {
            If.create();
            if (this.contentItem !== null) {
                this.ifElseBranchUpdateFunction(0, () => {
                    {
                        this.observeComponentCreation2((a1, b1) => {
                            if (b1) {
                                let c1 = new ContentItemStruct(this, {
                                    icon: this.contentItem?.icon,
                                    iconStyle: this.contentItem?.iconStyle,
                                    primaryText: this.contentItem?.primaryText,
                                    secondaryText: this.contentItem?.secondaryText,
                                    description: this.contentItem?.description,
                                    leftWidth: this.calculatedLeftWidth(),
                                    fontSizeScale: this.fontSizeScale,
                                    parentDirection: this.containerDirection,
                                    itemDirection: this.contentItemDirection,
                                    iconImageModifier: this.contentItem?.iconImageModifier,
                                    primaryTextModifier: this.contentItem?.primaryTextModifier,
                                    secondaryTextModifier: this.contentItem?.secondaryTextModifier,
                                    descriptionModifier: this.contentItem?.descriptionModifier,
                                    contentItemPadding: this.composeItemPadding,
                                    itemSpace: this.itemSpace
                                }, undefined, a1, () => { }, { page: "librarys/composelistitem/src/main/ets/components/composelistitem.ets", line: 1033, col: 11 });
                                ViewPU.create(c1);
                                let d1 = () => {
                                    return {
                                        icon: this.contentItem?.icon,
                                        iconStyle: this.contentItem?.iconStyle,
                                        primaryText: this.contentItem?.primaryText,
                                        secondaryText: this.contentItem?.secondaryText,
                                        description: this.contentItem?.description,
                                        leftWidth: this.calculatedLeftWidth(),
                                        fontSizeScale: this.fontSizeScale,
                                        parentDirection: this.containerDirection,
                                        itemDirection: this.contentItemDirection,
                                        iconImageModifier: this.contentItem?.iconImageModifier,
                                        primaryTextModifier: this.contentItem?.primaryTextModifier,
                                        secondaryTextModifier: this.contentItem?.secondaryTextModifier,
                                        descriptionModifier: this.contentItem?.descriptionModifier,
                                        contentItemPadding: this.composeItemPadding,
                                        itemSpace: this.itemSpace
                                    };
                                };
                                c1.paramsGenerator_ = d1;
                            }
                            else {
                                this.updateStateVarsOfChildByElmtId(a1, {
                                    icon: this.contentItem?.icon,
                                    iconStyle: this.contentItem?.iconStyle,
                                    primaryText: this.contentItem?.primaryText,
                                    secondaryText: this.contentItem?.secondaryText,
                                    description: this.contentItem?.description,
                                    leftWidth: this.calculatedLeftWidth(),
                                    fontSizeScale: this.fontSizeScale,
                                    parentDirection: this.containerDirection,
                                    itemDirection: this.contentItemDirection,
                                    iconImageModifier: this.contentItem?.iconImageModifier,
                                    primaryTextModifier: this.contentItem?.primaryTextModifier,
                                    secondaryTextModifier: this.contentItem?.secondaryTextModifier,
                                    descriptionModifier: this.contentItem?.descriptionModifier,
                                    contentItemPadding: this.composeItemPadding,
                                    itemSpace: this.itemSpace
                                });
                            }
                        }, { name: "ContentItemStruct" });
                    }
                });
            }
            else {
                this.ifElseBranchUpdateFunction(1, () => {
                });
            }
        }, If);
        If.pop();
        this.observeComponentCreation2((f, g) => {
            If.create();
            if (this.operateItem !== null) {
                this.ifElseBranchUpdateFunction(0, () => {
                    this.observeComponentCreation2((r, s) => {
                        __Common__.create();
                        __Common__.flexShrink(0);
                        __Common__.onFocus(() => {
                            this.canFocus = false;
                        });
                        __Common__.onBlur(() => {
                            this.canFocus = true;
                        });
                        __Common__.padding({ start: this.getOperateOffset() });
                    }, __Common__);
                    {
                        this.observeComponentCreation2((l, m) => {
                            if (m) {
                                let n = new OperateItemStruct(this, {
                                    icon: this.operateItem?.icon,
                                    subIcon: this.operateItem?.subIcon,
                                    button: this.operateItem?.button,
                                    switch: this.operateItem?.switch,
                                    checkBox: this.operateItem?.checkbox,
                                    radio: this.operateItem?.radio,
                                    image: this.operateItem?.image,
                                    text: this.operateItem?.text,
                                    arrow: this.operateItem?.arrow,
                                    parentCanFocus: this.__canFocus,
                                    parentCanTouch: this.__canTouch,
                                    parentIsHover: this.__isHover,
                                    parentFrontColor: this.__frontColor,
                                    parentIsActive: this.__isActive,
                                    parentCanHover: this.__canHover,
                                    rightWidth: this.calculatedRightWidth(),
                                    parentDirection: this.__containerDirection,
                                    isParentCanTouch: this.__isCanTouch
                                }, undefined, l, () => { }, { page: "librarys/composelistitem/src/main/ets/components/composelistitem.ets", line: 1052, col: 11 });
                                ViewPU.create(n);
                                let o = () => {
                                    return {
                                        icon: this.operateItem?.icon,
                                        subIcon: this.operateItem?.subIcon,
                                        button: this.operateItem?.button,
                                        switch: this.operateItem?.switch,
                                        checkBox: this.operateItem?.checkbox,
                                        radio: this.operateItem?.radio,
                                        image: this.operateItem?.image,
                                        text: this.operateItem?.text,
                                        arrow: this.operateItem?.arrow,
                                        parentCanFocus: this.canFocus,
                                        parentCanTouch: this.canTouch,
                                        parentIsHover: this.isHover,
                                        parentFrontColor: this.frontColor,
                                        parentIsActive: this.isActive,
                                        parentCanHover: this.canHover,
                                        rightWidth: this.calculatedRightWidth(),
                                        parentDirection: this.containerDirection,
                                        isParentCanTouch: this.isCanTouch
                                    };
                                };
                                n.paramsGenerator_ = o;
                            }
                            else {
                                this.updateStateVarsOfChildByElmtId(l, {
                                    icon: this.operateItem?.icon,
                                    subIcon: this.operateItem?.subIcon,
                                    button: this.operateItem?.button,
                                    switch: this.operateItem?.switch,
                                    checkBox: this.operateItem?.checkbox,
                                    radio: this.operateItem?.radio,
                                    image: this.operateItem?.image,
                                    text: this.operateItem?.text,
                                    arrow: this.operateItem?.arrow,
                                    rightWidth: this.calculatedRightWidth()
                                });
                            }
                        }, { name: "OperateItemStruct" });
                    }
                    __Common__.pop();
                });
            }
            else {
                this.ifElseBranchUpdateFunction(1, () => {
                });
            }
        }, If);
        If.pop();
        Flex.pop();
        Stack.pop();
    }
    getFlexLeftOutlineWidth() {
        return (this.composeItemPadding?.start !== undefined &&
            this.composeItemPadding?.start?.value >= DEFAULT_STACK_PADDING) ?
            (this.composeItemPadding?.start?.value - DEFAULT_FLEX_OUTLINE_WIDTH) :
            (this.composeItemPadding === null || this.composeItemPadding?.start === undefined ||
                (this.composeItemPadding?.start !== undefined &&
                    this.composeItemPadding?.start?.value >= DEFAULT_COMPOSE_ITEM_PADDING &&
                    this.composeItemPadding?.start?.value < DEFAULT_STACK_PADDING)) ?
                DEFAULT_COMPOSE_ITEM_PADDING : this.composeItemPadding?.start?.value;
    }
    getFlexRightOutlineWidth() {
        return (this.composeItemPadding?.end !== undefined &&
            this.composeItemPadding?.end?.value >= DEFAULT_STACK_PADDING) ?
            (this.composeItemPadding?.end?.value - DEFAULT_FLEX_OUTLINE_WIDTH) :
            (this.composeItemPadding === null || this.composeItemPadding?.end === undefined ||
                (this.composeItemPadding?.end !== undefined &&
                    this.composeItemPadding?.end?.value >= DEFAULT_COMPOSE_ITEM_PADDING &&
                    this.composeItemPadding?.end?.value < DEFAULT_STACK_PADDING)) ?
                DEFAULT_COMPOSE_ITEM_PADDING : this.composeItemPadding?.end?.value;
    }
    getComposeItemLeftPadding() {
        return this.composeItemPadding === null || this.composeItemPadding?.start === undefined ||
            (this.composeItemPadding?.start !== undefined && this.composeItemPadding?.start?.value >= DEFAULT_STACK_PADDING) ?
        LengthMetrics.vp(DEFAULT_FLEX_OUTLINE_WIDTH) :
            (this.composeItemPadding?.start !== undefined &&
                this.composeItemPadding?.start?.value >= DEFAULT_COMPOSE_ITEM_PADDING &&
                this.composeItemPadding?.start?.value < DEFAULT_STACK_PADDING) ?
            LengthMetrics.vp(this.composeItemPadding?.start?.value - DEFAULT_COMPOSE_ITEM_PADDING) : LengthMetrics.vp(0);
    }
    getComposeItemRightPadding() {
        return this.composeItemPadding === null || this.composeItemPadding?.end === undefined ||
            (this.composeItemPadding?.end !== undefined && this.composeItemPadding?.end?.value >= DEFAULT_STACK_PADDING) ?
        LengthMetrics.vp(DEFAULT_FLEX_OUTLINE_WIDTH) :
            (this.composeItemPadding?.end !== undefined &&
                this.composeItemPadding?.end?.value >= DEFAULT_COMPOSE_ITEM_PADDING &&
                this.composeItemPadding?.end?.value < DEFAULT_STACK_PADDING) ?
            LengthMetrics.vp(this.composeItemPadding?.end?.value - DEFAULT_COMPOSE_ITEM_PADDING) : LengthMetrics.vp(0);
    }
    rerender() {
        this.updateDirtyElements();
    }
}

export default { IconType, ComposeListItem };